package com.net.core.core;

import cn.hutool.core.thread.ThreadUtil;
import org.springframework.stereotype.Component;

import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;

@Component
public class MyThreadPool {

    private ThreadPoolExecutor threadPool;

    public MyThreadPool() {
        threadPool = ThreadUtil.newExecutor(10, 200);
    }

    public void exe(Runnable runner) {
        threadPool.execute(runner);
    }

    public Future<?> execAsync(Runnable runner) {
        Future<?> future = ThreadUtil.execAsync(runner);
        return future;
    }

}
